package com.just.boot.web.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

    /**
     * 处理AJAX请求跨域的问题
     * @author Just
     * @time 2017-07-13
     */
@Configuration
public class CorsConfig  implements WebMvcConfigurer {

        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**")
                    .allowedHeaders("*")
                    //.allowedOrigins("www.aquestian.cn","*","47.105.100.29","47.105.100.29:8080")
                    .allowedOrigins("*")
                    .allowedMethods("*")
                    .allowCredentials(true)
                    .maxAge(3600)
                   ;
        }
    }
